@echo off
setlocal enabledelayedexpansion
setlocal
SET fntpath=C:\Users\wxf\Desktop\document\242161
md %fntpath%\swc
dir %fntpath%\*.fnt /b  > %fntpath%\list.txt


rem get catalog from the first fnt file
set catalog=1
for /f "delims=" %%i in (%fntpath%\list.txt) do (
	set /a "lineCounter=0"
	for /f "delims=" %%j in (%fntpath%\%%i) do (
		set /a "lineCounter+=1"
	    if !lineCounter! EQU 2 (
	        set catalog=%%j
	        goto breakOuterLoop
	    )
	)
)
:breakOuterLoop
echo %catalog%

rem convert all the fnt to swc

for /f "delims=" %%i in (%fntpath%\list.txt) do (
	echo %%i
	rem echo %PATH%
	fnt-to-swc.exe %fntpath%\%%i %fntpath%\swc\%%i.swc
)


rem find all the point with mark 12

echo # %catalog%>>%fntpath%\swc\marker12.txt
for /f %%i in ('dir %fntpath%\swc\*.swc /b/s ') do (
	rem echo %%i
	for /f "tokens=1,2,3,4,5,6,7 delims= " %%a in (%%i) do (
		if not %%a==# (
			if not %%a==## (
				if %%b==12 (
					echo %%a %%b %%c %%d %%e >>%fntpath%\swc\marker12.txt

				)
			)
		)

	)

)
